<div id="move_file_popup">
	<h2>Move file(s)</h2>
	<div class="content">
		<div class="form300">
			<?= Phpr_Form::openTag() ?>

				<? if (!isset($fatalError)): ?>
					<div class="form">
						<!--[if IE]><fieldset class="ie_fix"><![endif]-->
							<div class="formFlash"></div>
						<!--[if IE]></fieldset><![endif]-->

						<ul class="formElements">
							<li class="field dropdown full">
								<label for="dest_dir">
									Destination directory<span class="required">*</span>
									
									<span class="comment">Please select a directory to move selected files to.</span>
								</label>
								<div class="fieldContainer">
									<? 
										$folders = array();
										$this->listFolders($folders);
									?>
									
									<select name="dest_dir" id="dest_dir">
										<? foreach ($folders as $folder): ?>
											<option <?= Phpr_Form::optionState($dir, $folder->path) ?> value="<?= h($folder->path) ?>"><?= str_repeat("&nbsp;", $folder->level*4).h($folder->name) ?></option>
										<? endforeach ?>
									</select>
								</div>
							</li>
						</ul>
						<div class="clear"></div>
					</div>

					<script type="text/javascript">
						$('move_file_popup').addEvent('popupLoaded', function(){
							$('dest_dir').focus();
						});
					</script>

					<?= backend_ajax_button('Move', 'index_onMoveFile', array(), "
						loadIndicator: {injectInElement: true},
						onSuccess: onFileMoved") ?>
					<?= backend_button('Cancel', array('onclick'=>"
						this.getForm().sendPhpr('index_onCancelMove', {loadIndicator: {show:false}});
						cancelPopup();
					")) ?>
					<input type="hidden" id="move_files" name="files" value="<?= h(implode(',', $files)) ?>"/>
					<input type="hidden" id="move_files_src_dir" name="dir" value="<?= h($dir) ?>"/>
				<? else: ?>
					<div class="formFlash"><?= flash() ?></div>
					<?= backend_button('Cancel', array('onclick'=>'return cancelPopup();"
					')) ?>
				<? endif ?>
			
				<div class="clear"></div>
			</form>
		</div>
	</div>
</div>